<template>
	<view class="page">
		<!-- <view class="login">
			<u--input placeholder="请输入账号" border="surround" v-model="value" class="input"></u--input>
		</view>
		<view class="button">
			<u-button type="primary" text="登录" size='normal' @click="login"></u-button>
		</view>

		<view class="button">
			<u-button type="error" text="退出登录" size='normal' @click="clearCookies"></u-button>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: ''
			}
		},
		methods: {
			login() {
				this.$request('/auth/loginByMpTest', {
					code: this.value
				}, "POST").then(res => {
					if (res.code == 0) {
						uni.setStorageSync('token', res.token);
					} else {
						uni.navigateTo({
							url: '/pages/exchange/login'
						})
					}

				})
			},
			clearCookies() {
				uni.clearStorageSync('token')
			}

		}
	}
</script>

<style>
	.page {
		height: 100vh;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.input {
		background-color: #fff;
		width: 400rpx;
	}

	.button {
		width: 200rpx;
		margin-top: 25rpx;
	}
</style>
